package com.wuan.study.service.impl;

import com.wuan.study.event.Event_1;
import com.wuan.study.event.Event_2;
import com.wuan.study.event.Event_3;
import com.wuan.study.service.EventService;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author v-wuan
 * @date 2023/7/13 16:14:22
 * @desc
 */
@Service
public class EventServiceImpl implements EventService {
    @Resource
    private ApplicationEventPublisher applicationEventPublisher;

    @Override
    public void eventPublish1() {
        applicationEventPublisher.publishEvent(new Event_1("遇到抢劫，报警１１０！"));
    }

    @Override
    public void eventPublish2() {
        applicationEventPublisher.publishEvent(new Event_2("遇到火灾，消防１１９！"));
    }

    @Override
    public void eventPublish3(Long id) {
        applicationEventPublisher.publishEvent(new Event_3(id));
    }
}
